package com.jqsoft.launcher.common;

import com.jqsoft.launcher.util.Log;

import java.util.HashMap;
import java.util.Map;

/**所有组拼的URL路径 包括公共服务的和交易服务的
 * @author gujunqi
 * date：2013-12-24 
 */
public class BphsURL {
	private static String tag = "BphsURL";
	public static final String ACTION_COMMON_PARAM_MOBILE_MAC = "@mobileMac";

	/** 保存公共信息相关访问相对路径 */
	public static Map<String, String> commonInfoMap = new HashMap<String, String>();
	static {
		// 客户端版本验证
		commonInfoMap
				.put("VersionCheck",
						"mobile.shtml?action=act038&mobileMac=@mobileMac&mobileType=Android&version=@Version&appId=1");
		// 客户端版本检查更新状态 1：no ， 2：recommended，3：force update
		commonInfoMap
				.put("VersionCheckUpdateStatus",
						"mobile.shtml?action=act039&mobileMac=@mobileMac&mobileType=Android&version=@Version&appId=1");

		//登录 
		commonInfoMap.put("LOGIN_URL","AndrewsWebService.asmx");
		commonInfoMap.put("LOGIN_METHOD","GetUserInfo");
		//测试功能
		commonInfoMap.put("TEST_URL","Andrews/HypertensionWebService.asmx");
		commonInfoMap.put("TEST_METHOD","GetHypertensionManageData");
		//获取字典数据库的信息
		commonInfoMap.put("GetDictionaryCatalog_URL","DictionaryDetail.asmx");
		commonInfoMap.put("GetDictionaryCatalog_METHOD","GetDictionaryCatalog");
		//比对字典数据库，看是否需要更新
		commonInfoMap.put("GetDictionary_URL","DictionaryDetail.asmx");
		commonInfoMap.put("GetDictionary_METHOD","GetDictionaryVersionNumber");
		//获取儿童管理列表的信息
		commonInfoMap.put("GetChildrenList_URL","Andrews/ChildrenInfoWebService.asmx");
		commonInfoMap.put("GetChildrenList_METHOD","GetChildrenInfoManageData");
		//提交儿童随访信息
		commonInfoMap.put("AddNewBorn_URL","Andrews/ChildrenInfoWebService.asmx");
		commonInfoMap.put("AddNewBorn_METHOD","AddNewBornVisiting");
		//糖尿病确诊管理
		commonInfoMap.put("GetType2Diabetes_URL","Andrews/Type2DiabetesWebService.asmx");
		commonInfoMap.put("GetType2Diabetes_METHOD","GetType2DiabetesManageData");
		//糖尿病患者随访服务记录表
		commonInfoMap.put("AddType2Diabetes_URL","Andrews/Type2DiabetesWebService.asmx");
		commonInfoMap.put("AddType2Diabetes_METHOD","AddType2DiabetesVisiting");
		//高血压筛选
		commonInfoMap.put("GetHypertension_URL","Andrews/HypertensionWebService.asmx");
		commonInfoMap.put("GetHypertension_METHOD","GetHypertensionScreening");
		//高血压确诊管理
		commonInfoMap.put("GetHypertensionManageData_URL","Andrews/HypertensionWebService.asmx");
		commonInfoMap.put("GetHypertensionManageData_METHOD","GetHypertensionManageData");
		//高血压患者随访服务记录表
		commonInfoMap.put("GAddHypertensionVisiting_URL","Andrews/HypertensionWebService.asmx");
		commonInfoMap.put("AddHypertensionVisiting_METHOD","AddHypertensionVisiting");
		//重性精神病患者随访管理
		commonInfoMap.put("GetPsychosisPersonManage_URL","Andrews/PsychosisPersonWebService.asmx");
		commonInfoMap.put("GetPsychosisPersonManage_METHOD","GetPsychosisPersonManageData");
		//重性精神疾病患者随访服务记录表
		commonInfoMap.put("AddPsychosisPersonVisiting_URL","Andrews/PsychosisPersonWebService.asmx");
		commonInfoMap.put("AddPsychosisPersonVisiting_METHOD","AddPsychosisPersonVisiting");
		//人员信息列表
		commonInfoMap.put("GetPersonInfoManageData_URL","Andrews/PersonInfoWebService.asmx");
		commonInfoMap.put("GetPersonInfoManageData_METHOD","GetPersonInfoManageData");
		//孕产妇保健管理
		commonInfoMap.put("GetPregnancyInfoManageData_URL","Andrews/PregnancyInfoWebService.asmx");
		commonInfoMap.put("GetPregnancyInfoManageData_METHOD","GetPregnancyInfoManageData");
		//产后访视信息表
		commonInfoMap.put("AddPostpartumVisiting_URL","Andrews/PregnancyInfoWebService.asmx");
		commonInfoMap.put("AddPostpartumVisiting_METHOD","AddPostpartumVisiting");
		
//		工作提醒
		commonInfoMap.put("GongzuoRemind_URL","RemindWebService.asmx");
		commonInfoMap.put("GongzuoRemind_METHOD","GetTiXing");
//		工作明细的详情
		commonInfoMap.put("GongzuoDetailRemind_METHOD","GetMingxi");
		
//		心电
		commonInfoMap.put("GetPersonInfoByECG_METHOD","GetPersonInfoManageDataByECG");
		commonInfoMap.put("XINDIANECGWebService_URL","Andrews/ECGTBWebService.asmx");
		commonInfoMap.put("XINDIANAddToECGTB_METHOD","AddToECGTB");
		commonInfoMap.put("XINDIAN_ECG_GET_ONE_DATA_METHOD", "GetECGTBData");
		
//		
		commonInfoMap.put("YiliaoService_URL","Andrews/CommunityServiceWebService.asmx");
		commonInfoMap.put("YiliaoService_METHOD","AddToService");
		//  老年人
		commonInfoMap.put("GetOldPeopleManageData_URL","Andrews/OldPeopleWebService.asmx");
		commonInfoMap.put("GetOldPeopleManageData_METHOD","GetOldPeopleManageData");
	};

	/**
	 * 取得交易全路径
	 * 
	 * @param pathKey
	 *            要访问的URL标识
	 * @return
	 */
	public static String getCommonPath(String pathKey) {
		StringBuffer result = new StringBuffer();
		if(!pathKey.contains("_METHOD")){
			if (BphsConstants.isProduct) {
				// 生成环境
				BphsConstants.WEB_ROOT = BphsConstants.HTTP_PROTOCOL
						+ BphsConstants.HTTP_SERVER_IP + ":"
						+ BphsConstants.HTTP_SERVER_PORT + "/"
						+ BphsConstants.PROJECT_PATH + "/";

			} else {
				// 测试环境
				BphsConstants.WEB_ROOT = BphsConstants.HTTP_PROTOCOL
						+ BphsConstants.HTTP_TEST_SERVER_IP + ":" + BphsConstants.HTTP_TEST_SERVER_PORT
						+ "/" + BphsConstants.PROJECT_PATH + "/";
			}
			result.append(BphsConstants.WEB_ROOT);
		}
		result.append(commonInfoMap.get(pathKey));
		Log.d(tag, "URL标识:" + result.toString());
		return result.toString();
	}

}
